{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# High Dimensional Space\n",
    "## Introduction\n",
    "- High dimensional space is different.\n",
    "- The distance between all pairs of points will be essentially the same.\n",
    "- The volume of the unit ball goes to zero.\n",
    "- The volume of a unit ball is concentrated near its surface and its equator."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## The Law of Large Numbers\n",
    "The square of the distance between two points $y$ and $z$:\n",
    "\n",
    "$$ |y-z|^2 = \\sum^d_{i=1} (y_i - z_i)^2 $$\n",
    "\n",
    "can be viewed the sum of $d$ independent samples of a random variable $x$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "$$ x_i = (y_i - z_i)^2 $$\n",
    "Random variable $x$ has bounded variance. So we can use **The Law of Large Numbers**:\n",
    "\n",
    "$$ Prob(|\\frac{x_1 + x_2 + \\dots + x_n}{n} - E(x)| \\geq \\epsilon) \\leq \\frac{Var(x)}{n\\epsilon^2} $$\n",
    "\n",
    "It means that, with high probability, the sum is close to its expectation."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Then I try to use Python to validate this law."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.62796919 -0.00277906  1.41255307  0.23688436]\n"
     ]
    }
   ],
   "source": [
    "def get_gaussian_point_constant_throughout(dimensional):\n",
    "    # set expectation to 0 and variance to 1/2pi\n",
    "    # thus, mu = 0 and sigma = \\sqrt(1/2pi)\n",
    "    # so that the Gaussian probability density equals 1 at the origin\n",
    "    # and is bounded below throughtout the unit ball by a constant\n",
    "    return np.random.normal(0, np.sqrt(1/(2*np.pi)), \n",
    "                            dimensional)\n",
    "print(get_gaussian_point_constant_throughout(4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "18.384776310850235\n"
     ]
    }
   ],
   "source": [
    "def distance_origin(point):\n",
    "    return np.sqrt((point**2).sum())\n",
    "print(distance_origin(np.array([5, 12, 13])))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "How many points are in the unit ball?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {},
   "outputs": [],
   "source": [
    "def test_unitball(dimensional, samples):\n",
    "    test_points = np.array([get_gaussian_point_constant_throughout(dimensional)\n",
    "                            for i in range(samples)])\n",
    "    test_distances_origin = [distance_origin(point) \n",
    "                             for point in test_points]\n",
    "    plt.title(\"{} Gaussian points' distance in {}-d space, $\\mu = 0, \\sigma =1 /\\ 2\\pi$\"\n",
    "              .format(samples, dimensional))\n",
    "    plt.xlabel(\"Distance from origin\")\n",
    "    plt.ylabel(\"Counts\")\n",
    "    plt.hist(test_distances_origin, 50)\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY0AAAEYCAYAAACgDKohAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAH4BJREFUeJzt3Xm4XFWZ7/HvjyQQZog5IFM8oIDQKKAHHPA6gV4GG1AZRQxKd1q5iIgD2Hpb27afjt1XRVsF04CkuSiTIIMiIoNcZZAwI4hgDBCJJCBhFkh47x9rBYqihlXn1K6qc/h9nqee2vN6a9fw1lp777UVEZiZmZVYqd8BmJnZ+OGkYWZmxZw0zMysmJOGmZkVc9IwM7NiThpmZl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6evhowNQ9vTroim7zcw6R+lVYCriJ1fLcyqauRHfJya+XtzgK+kKetAswDNm0Q5wJgeh7+EikZrZrHPwV8Pw+/mtSVyFRSh493kfryGspxfTQv9w3gyAblnA/MzMMfAX6ch08GLgAm5fFDgG/n4QuAA/PwR1fsZ1JSu7Vm+fmkhDcVuJvUi3HfPxd+DP7DxzRskDTqMvTXwNclHQGsE42bYqaQuuu4BTiTdMOjFX4TEQsj9Sx7I+nHc0tgUURcCxARj+TtvpvUH9ONwDWkbiw2L4j7vIh4Mg+/hVTrISJ+R/pB3iLPuywiHo2IJaSkcX6efkuOq96bSM125G3W9vR6ZkQsb7LOmXm41V0ML4nUr9hfSTfs6endIm38mhB9T9n4l5unlpN6gN1qxfSImC3pJ6R+kq7OvQHX+yRwP6knz5V44Y2iansMXk76zIvG3YAL+HhEXNRh+I/XbaOZ2lierRl/lrLvYm3Mjzddqkyj/WLWlmsa1neShkg3tPl2RETdvFdGxC0R8VVSc9GrgUdJzTwrrE2qOTxLOkYwqU2RvwM2zMc1kLRm7i7/IuBjkqbk6VtIWr3Fdhq5AjhoxfrADNLxj9G4kuc71jwI+FXBOlcD78/DPemU015a/O/C+mXV3Aw0hXTA+BTg6w2WOzLfiGc5qRnlQtI/82WSbiK1738X+JGkfYHLaPMvPCKelrQ/8J+SVgWeBHYh3bthGLheqWvVJaSD1534LnB8bipbRurZ9qlR3qznCOAkSZ/JsZT0RHsk8H8lfQr4CakZzKxrfPaU2QSS75/wZESEpANIB8Ub3fPdbFRc0zCbWF4PfDvXlJaSzroy6xrXNMzMrJgPhJuZWTEnDTMzK+akYWZmxZw0zMysmJOGmZkV+//yKSZ6vcTpKgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_unitball(1, 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image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Xx1Vlma5H8iNonIiIkHUpqZB/1566bDXNNxGzt8grgy7km9TDpqi6z2rgmYmZmlblh3czMKnMSMTOzypxEzMysMicRMzOrzEnEzMwq+/8Os/7fHgeCNwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_unitball(10, 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZUAAAEYCAYAAACUdWs9AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHgpJREFUeJzt3Xm4XFWZ7/HvjyQQZBBiApcpBjUiiAq3DzQKjwPQLVMDzqCtUbFzbUUaERH1Pt1q63Nj973K7XZqFCWNKEEUhSDSiMFuBwKJMqOC8TAIlwQhzIIh7/1jrQOVooZ9zlm7hpPf53nqqT3vt1atqrf2XnuvUkRgZmZWwib9DsDMzKYOJxUzMyvGScXMzIpxUjEzs2KcVMzMrBgnFTMzK8ZJxczMinFSMTOzYpxUekzSDZJe2e84Gg1CTJLOlPTJQYlnooY19sbyN5uMWpKKpOMlrZD0mKQzm+bNknS+pIcl3SrpzVXnd1u3TSzHSFqe11mdh98jScVe8DhExAsj4vJ+7Lud8cQkaVTSweNYdl5d8Ywnll6ZzPvb6XOT5xf9bNj4DFoZd6sveZkdJd3RYvpmks7Ir+NBSb+UdGiJuKaX2EgLdwKfBF4NbN407/PA48D2wF7ARZKuiYgbKszvtu4GJH0AOAV4L3AJ8FBe72TgDOCxMi/XrIhOnxso+NmwCRm0Mu5WXwAOA37QYvp04HbgFcBteblzJb0oIkYnFVVE1PbIL/jMhvEtSG/K8xumnQUs6ja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AAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_unitball(100, 1000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can see that, with the increasing of dimensional, there are fewer and fewer points in the unit ball (whose distance < 1). So the volume of unit ball is very small in high dimensional space."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[ 0.52985749  1.74475468 -3.02261382 -0.24185653]\n"
     ]
    }
   ],
   "source": [
    "def get_gaussian_point_unit_var(dimensional):\n",
    "    # set expectation to 0 and variance to 1\n",
    "    # thus, mu = 0 and sigma = 1\n",
    "    return np.random.normal(0, 1, dimensional)\n",
    "print(get_gaussian_point_unit_var(4))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[11.369480608868622, 11.288482626633831, 9.109153926515464, 10.866010544043247, 10.149714455846613, 9.31371794798683, 10.555076289892984, 10.865577912112784, 9.830335448038296, 9.93775390541916]\n"
     ]
    }
   ],
   "source": [
    "print([distance_origin(get_gaussian_point_unit_var(100)) \n",
    "       for i in range(10)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {},
   "outputs": [],
   "source": [
    "def test_unit_var_points_length(dimensional, samples):\n",
    "    test_points = np.array([get_gaussian_point_unit_var(dimensional) \n",
    "                            for i in range(samples)])\n",
    "    unit_var_distances = [distance_origin(point) \n",
    "                          for point in test_points]\n",
    "    plt.title(\"{} Gaussian points distance in {}-d space, $\\mu = 0, \\sigma = 1$\"\n",
    "              .format(samples, dimensional))\n",
    "    plt.xlabel(\"Distance from origin\")\n",
    "    plt.ylabel(\"Counts\")\n",
    "    plt.hist(unit_var_distances, 50)\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEYCAYAAABRB/GsAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHK5JREFUeJzt3Xu0HFWZ9/HvjxAIEARiAoZLCCAyIMjFwIvCUgR0uA2ggoAIQZnJyyiDCIJ4WTOjw6wJ876jjFdERDIIco9AFBG5jEtFIEGQ+4AxQCQvCUi4CyR53j/2PtDp9KU6OdV1zqnfZ61ep7pqV++nd/epp2vv7l2KCMzMrL5WqzoAMzOrlhOBmVnNORGYmdWcE4GZWc05EZiZ1ZwTgZlZzTkRmJnVnBOBmVnNORGMAJLuk7RX1XE0qiImSRdIOrPKGAZLlbE3t6ONfMMmEUg6UdJsSa9IuqBp2zhJMyW9KOlRSR8tur3bvm1iOVLSbXmfhXn5k5I0aE+4BxHx9oi4pYq62+klJknzJO1bVQxl1b8qVuU1lbStpJskPSvpEUkfHOTwam1ljhl9iKnt8bGIYZMIgCeAM4HzW2z7FvAqsBFwNPAdSW8vuL3bvsuRdCrwn8D/Ad6S9zsB2ANYY2WfnNlgkLQ6cDUwCxgHTAN+KOltlQY2svR0zOiTTsfH7iJiWN3yk72g4f46pBflbQ3rLgSmd9vebd8Wda8HvAh8uEuMZwB/AJ4H7gc+2LQ9gLc23L8AODMvfw74U973IWCfTuvztnnAvt3qzuU+C/weeBa4FBjT4XnMAz6fH+cZ4AcD5YFtgVuAxcB9wMEt9t23W725vZcBLwMvAKd3eq5NdewM3JnLXQpcMtCOLWJo166t6u/2+nV6PpsBVwGLgKeBbzbstzFwZd72R+CkLm3ftf1a7Ld9fh5qWPdz4F861NWxHZvKtmvHtu+VAu/LQWmzFrF+EfhOw/0NgNfatV3Bx+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j/QJfxmpz31UlyofBDbO4wRIWjdPlXw9abK70Xn92/Jskb34JXD0wP6kyfQe6vExBvyGNyZrOxr4VYF9fgt8OC9XMtGbDT/+FGBVWSt3wYwmDapeCLSalvpkSe8jfWq9nzQAugxYIuluUn/5t4ErJR0O3EyXT8sR8aqkI4Bv5OmdXyZN8XweqYvmzjwN9iLSAG8vvg2ck7uplgDHRcQrWrmrNJ4EnC/ptBxLkRkpTwZ+KOlU4CekLiizjvytIbMRRNLawMsREZKOJA0cH1J1XDa0+YzAbGR5J/DNfEazmPRtI7OOfEZgZlZzHiw2M6s5JwIzs5pzIjAzqzknAjOzmnMiMDOruf8PMU8lyv4yg08AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_unit_var_points_length(9, 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEYCAYAAAC+xZqSAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAG0dJREFUeJzt3Xm0ZGV57/HvjwZsZBCQhjC1LYrTxYim9TrFCW8i6BUnBEdUkr5JVESciLpuNDErkJWoSRwIAYU4AQ5ExahRnK4TMggRBEWxGQRpUEAZFBqe+8feB6pPV52qc7qr9jl9vp+1ap0976fe2mc/9b5777dSVUiSFrfNug5AktQ9k4EkyWQgSTIZSJIwGUiSMBlIkjAZSJIwGUiSMBksSEkuTPKkruPo1UVMSU5M8o4uY9hY5mvs08tYm655mwySvCrJ2Ul+l+TEafN2THJakpuTXJbkhaPOH7bugFgOSXJmu86advgvkmSjveFZqKr/UVVf62Lfg8wmpiSrkzy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1/sjfnmgUuNpl+5aBGzZqDOJVkGHEvT1FHT5t2vqn5QVcfQNNs8CPgNTXPLlHvRfNO/k6YNfsmQXV4M7NZeNyDJtu0vlH0R+PMkW7TTHzCHHzL6BvCiqfVpOiP70Sy3MeXb3P3zmS8CvjnCOt8FntsOL+qf3tTs+G1AXdmqbY7ZguZC64eAd/ZZ7ogkT6b59vpDmouidwJrk5xP037+PuCTSQ4CvsqQb81VdVuSg4F/SbIVcCvNbxIcT9Ncc27bFfW1zP4nCd8HHNs2Wa0FXlZVv2s2N2uHAx9I8oY2lpePsM4RwIeTvA74HE1zlDSUdxNJm5C2a/Fbq6qSHEJzMfnAruPS/GfNQNq0/AHwnrZmcwPNXUjSUNYMJEleQJYkmQwkSZgMJEmYDCRJmAwkScD/B+YOHr1nIvVRAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_unit_var_points_length(64, 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEYCAYAAAC3LjroAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAG0ZJREFUeJzt3Xm4XXV56PHvSxiCDEIkIMgQ1GjhosY2cK3yWARuBeSCE4pSjEpvrlVKERVRfKpt9Sne3qqtY1PRpE6AAzLVoiLo40zggoCgYAzIIAkKyowh7/1j/QKbs/Z4ctbe+5zz/TzPfs6a17t/a5317t9vTZGZSJLUapNRByBJGj8mB0lSjclBklRjcpAk1ZgcJEk1JgdJUo3JQZJUY3KQJNWYHKaBiLgmIg4YdRytRhFTRCyPiPeOMoapMl1jn7gNNHONTX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oGfdgS/fDVPt80P5FLQH8dWZeOGD4905YRietsaxv6V9Pf/+LrTHf23Gq/rQrF+kR1hw0chExH/gEVdNIThj3lKyehvl+qmaePwLupmqe2eDxVDWB9VRt+HN6rPI6YJdy3oGI2CYiNgUuBP4qIjYrw58WEVt1WU473wGO2TA/1cMhJ/tWvu8DR5fuY4Dv9jHPD3n0MdtHd5tQ6sZfCxqVLUvzzWZUJ24/A3ygzXQnRsQLqH7d/pTqJOt6YF1EXEnV/v4x4MsRcRRwMT1+VWfmQxHxSuDDEbElcD9wMPBJquady6N6zddaBn8F7ceAT5QmrnXAazPzwUm+NewE4FMR8bYSy+v6mOdE4LMR8RbgAqrmK2lgXq0kzSDlbWX3Z2ZGxNFUJ6ePHHVcmn6sOUgzy58AHyk1n7uornKSBmbNQZJU4wlpSVKNyUGSVGNykCTVmBwkSTUmB0lSzf8Hfl102u1Z3nkAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_unit_var_points_length(144, 1000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can see that the most common length in $d$-dimensional space is $\\sqrt{d}$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "How about the distance of a pair of Gaussian points?"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {},
   "outputs": [],
   "source": [
    "def distance_pair(point1, point2):\n",
    "    return distance_origin(point1-point2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {},
   "outputs": [],
   "source": [
    "def test_distance_pair(dimensional, samples):\n",
    "    test_points1 = np.array([get_gaussian_point_unit_var(dimensional) \n",
    "                            for i in range(samples)])\n",
    "    test_points2 = np.array([get_gaussian_point_unit_var(dimensional) \n",
    "                            for i in range(samples)])\n",
    "    pair_distances = [distance_pair(point1, point2) \n",
    "                          for point1,point2 in zip(test_points1, test_points2)]\n",
    "    plt.title(\"{} pair Gaussian points distance in {}-d space, $\\mu = 0, \\sigma = 1$\"\n",
    "              .format(samples, dimensional))\n",
    "    plt.xlabel(\"Distance pair\")\n",
    "    plt.ylabel(\"Counts\")\n",
    "    plt.hist(pair_distances, 50)\n",
    "    plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZEAAAEYCAYAAACdnstHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHJdJREFUeJzt3Xm4XFWZ7/HvLwMkBBACAcMQA0pzQZTAc6BpoGkmvUyX6TJqa66X7nSLE9AqODzdanufDte+StsoGoMk2kCCDBdEERWFFtRAmGT0gjGQQCRhklEg4b1/rHWgOKnprHN21amT3+d5znOq9rTevWpXvbXW2rW3IgIzM7MSY7odgJmZ9S4nETMzK+YkYmZmxZxEzMysmJOImZkVcxIxM7NiTiJmZlbMScTMzIo5ibRJ0j2S9u92HEMxEvehGzFJmifpi92MYbiM1NgH1rGNXh1JIpI+LGmxpJckzRswb7KkKyQ9L+khSe9pd36rdYdTRLw9Iq4fzDqSTpK0KMe3Mj8+VZIqCrOpkn2o2mBikrRU0sHdiqGq8odiKK9pi/fldEk/lPSUpD9IOlfSuOGI2ZJOfn61GU/D46GZTrVEHgW+CHy7zryvAS8DWwLvBc6T9PY257dat3KN3liS/gH4N+BLwJtJMf49sA+wXscCNGus2fvy68BKYCowA/gr4NTOhbZO6Prn1wDNjofGIqJjfznAeTXPJ5Eq8c9qpn0XmN1qfqt1G5S/FPgUcC/wFHABMCHPOwv4HfBsnn9MnXUPrnl8JvAb4CVg3IBl3wQ8D/z3FvXRqswA3lbzfB7wxfz4TOCRvO5vgY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TdRboK7s41826OiOUR8SpwBzCdlARWRMQtABHxTN7uu4H351sXLAI2A3aoU96yiLgpP/4PYN/8+ABJi3IcBwJvb7CfCxtMN+uYXrl2lllbJG0PrCG1Knbqnx4RsyX9gHRfh183GKA+HXgM2JX0BetPNfNeqnm8hvTeEfVvjibgIxFxbYtwB64bSreC/TrpjpHLJH0OaHR72OdbbN+scm6J2KghaQrwDVJ3UAyY99aIuCsizgYWA/8FeBbYqGaxN5FaFq8C7wPGtijyfmArSXvkMjbKd+O7Fvig0q2ckfRnDW50NU2v38/9ZNJtYfsTxuOSNgSOa2ffzbrFLRHrdRNzt9F40lVfvwt8uc5yp0k6gNSKuBe4hnR3ydWS7gTmkVoAl0k6Hvg5Lb7pR8TLkk4E/j3fouBF0rjIXFJ31215UHwVcHSdTdwHzJT0TdK9Js6LiBckfQu4C1gK3NJmPZh1hU/xNesCSdOBq/PguVnPcneWmZkVc0vEzMyKuSViZmbFnETMzKyYk4iZmRVzEjEzs2JOImZmVuz/A0tq95SlXLSYAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_distance_pair(18, 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAEYCAYAAAB7twADAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHU1JREFUeJzt3Xm0XFWZ9/HvjwQIMiYSMAwxgIiAQmBdaBRURhtQmWSU1ry9aKMgKtgoKL6itr06iC1q09BGwEQbmaFBFBFpwBYVCBBmfIPpQAIhCZPMhITn/ePsC0Wl5rtP1a3L77PWXbfOuJ9zTt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allYGlgE/A75XY77jVDy3fTlwH3A1Rc/RyyTdSfFM8TOBSyUdAlxPkxpARCyVdBjwb5JWo7h+sidwNkWT2O3pgvoS4IAaq7gfmCLpRxRdo58VES9I+jFwN0UPyre2uB/Mes63DZv1gKRJwFXpwrvZiOAmLzMzy8I1FDMzy8I1FDMzy8IJxczMsnBCMTOzLJxQzMwsCycUMzPL4v8D0ilGsZtn2TwAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_distance_pair(128, 1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAZQAAAEYCAYAAAB7twADAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAHIZJREFUeJzt3Xm4ZHV95/H3B5otgEKHBgFp2wWNW0SncYyaRNFJFI1bRERGmRkmuMYtLkQdNcY8gWSixhiXdgnEQYG4ROMSjQsmbkhDQFFIUNLIJg1GBBXFhu/8cc7F4lLbvX2q6lb3+/U897lV53fO+X3rd06db/3OmqpCkqSttcOsA5AkbRtMKJKkTphQJEmdMKFIkjphQpEkdcKEIknqhAlFktQJE4okqRMmlAGSfDPJw2Ydx9ZYiZ9hFjElOSnJ62cZQ1fmNfbFy0DbpokklCTPS7Ixyc+SnLSobHWSDyf5cZJLkjxt3PJR03apqu5dVWcsZZokT01yZhvf5vb1c5JkQmEOtZzPMGlLiSnJpiSPnFUMk6p/ayx3mSbZJcm72+/N9Un+Ncmje8rXJflEkh8k+V6StyRZNW65tt40t29jxjNwOz7IpHooVwCvB97Tp+yvgRuB/YCjgbclufeY5aOmnbhBX6IkfwD8JfD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h3gPYUFW/ClwHPKcd/paqOrSq7gPsRnOftn5+WlUPrapTx2ocacJMKNoW9bsr7ZeANyR5PrBXzzNkeu0EvDPJN4C/o0keC75WVZe1N1g8F1hHkxCurKqzAKrquna+vwU8I83T+s4EfhnovXfZgkur6kvt6/8HPLR9/fD2tu3foLmf1b0HfM7t7uaDWtlWzToAqUtJ7gLcRNPbuOfC8Ko6IcnHgcOBrw44uP0i4CrgfjQ/tn7aU/azntc30Xx3Qv8HbQX4/ar61IhwF09bSXYF3kpzn7BLk7wW2HXA9D8eMX9pquyhaJuRZA3wdppdRrWo7K7tHYNPBDYCvwJcT/P41gW3p+lx3Aw8HdhxRJUXAgekffhTe/xkFc0jgp/d3t6cJHdPsnuf6dcm+bX29VHAF/lF8rgmzbM2njzOZ5dWAnsomne7tbuWdqJ5CNZ7gX6PJXhhkofT9C6+RfNky5uBLUnOA06i6Rl8MMkRwOcZ0QOoqhuTHAn8VZLdaI6fPBJ4F80usXPaA+pXA0/oM4sLgGOSvAO4CHhbVf0kyTtp7mK7CThrzHaQZs7ThqUZSPPY2I+1B96lbYK7vCRJnbCHIknqhD0USVInTCiSpE6YUCRJnTChSJI6YUKRJHXi/wPRw5Ukr+2PiAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "test_distance_pair(288, 1000)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Similarly, in $d$-dimensional space, the distance between Gaussian points is $\\sqrt{2d}$."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And we can find that $|y|^2 + |z|^2 = |y-z|^2 = 2d$, therefore, $y$ and $z$ must be approximately orthogonal."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## The Geometry of High Dimensions"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "1. Most of the high-dimensional objects' volume is near the surface.\n",
    "\n",
    "**Proof**:\n",
    "\n",
    "For $A$ in $R^d$, shrink A by a small amount $\\epsilon$. Now we get a new object $(1-\\epsilon)A = \\{(1-\\epsilon)x|x \\in A\\}$. Then:\n",
    "\n",
    "$$ volume((1-\\epsilon) A) = (1-\\epsilon)^d volume(A)$$\n",
    "\n",
    "Using $1-x \\leq e^{-x}$,\n",
    "\n",
    "$$ \\frac{volume((1-\\epsilon)A)}{volume(A)} = (1-\\epsilon)^d \\leq e^{-\\epsilon d} $$"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Fix $\\epsilon$. When $d \\rightarrow \\infty$, the fraction approaches zero. This means the object is \"empty\" inside."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Properties of the Unit Ball"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Most of the volume is concentrated in a small annulus of width $O(1/d)$.\n",
    "- The volume of the ball goes to zero.\n",
    "- Most of the volume is concentrated near its \"equator\". Remember that with high probability two points are approximately orthogonal. So for $y$, other points are near its equator."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
